Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
abstract-logging
Advanced tools
A noop logger that conforms to the Log4j interface for modules to stub out internal logging
The abstract-logging npm package provides a minimalistic logging interface that is compatible with the log method signature of the pino logger. It is primarily used as a placeholder logger in modules that expect a logger to be passed to them, allowing developers to use a no-op (no operation) logger when they don't want to perform any logging. This can be useful for testing or for disabling logging in production for performance reasons.
No-op logger
The abstract-logging package provides a no-op logger with methods that can be called like a normal logger but do not perform any operations. This is useful for disabling logging or for providing a logger to modules that require one without actually logging any messages.
{"logger": {"info": function() {}, "error": function() {}, "debug": function() {}, "fatal": function() {}, "warn": function() {}, "trace": function() {}, "child": function() { return this; }}}
The noop-logger package provides a similar functionality to abstract-logging by offering a logger with no-op methods. It can be used to silently ignore all logging operations.
Bunyan-blackhole is another package that provides a no-op logger, specifically designed to work with the Bunyan logging library. It is similar to abstract-logging but tailored for Bunyan's API.
Pino-noir is not a no-op logger but offers a feature to redact certain log fields. It is related to abstract-logging in the sense that it can be used to control the output of logs, although it serves a different purpose by focusing on privacy and security rather than completely disabling logging.
This module provides an interface for modules to include so that they can support logging via an external logger that conforms to the standard Log4j interface. One such logger is Pino. This module is intended for modules that are meant to be used by other modules.
Example:
'use strict'
function AwesomeLibrary (options) {
this.log = (options.logger) ? options.logger : require('abstract-logging')
}
AwesomeLibrary.prototype.coolMethod = function () {
this.log.trace('AwesomeLibrary.coolMethod was invoked')
return {}
}
module.exports = AwesomeLibrary
Available methods:
fatal
error
warn
info
debug
trace
All methods are no operation functions.
Some loggers, like Pino, implement a child()
method. This method can be easily added to an abstract-logging
instance when stubbing out such loggers:
const logger = require('abstract-logging')
logger.child = () => logger
FAQs
A noop logger that conforms to the Log4j interface for modules to stub out internal logging
We found that abstract-logging demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.